package com.itheima.app.interceptor;

import com.itheima.domain.db.User;

// threadLocal工具类操作user对象
public class UserHolder {

    private static final ThreadLocal<User> TL = new ThreadLocal<User>();

    // 向线程内存储user
    public static void set(User user) {
        TL.set(user);
    }

    // 从线程内获取user
    public static User get() {
        return TL.get();
    }

    // 删除线程内user
    public static void remove() {
        TL.remove();
    }
}
